import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'

import * as userinfoActions from '../actions/userinfo'

class Home extends React.Component {
    render() {
        return (
            <div className="container-fluid">
                <hr/>
                <p>用户名：{this.props.userinfo.userid}</p>
                <hr/>
                <p>所在城市：{this.props.userinfo.city}</p>
                <hr/>
                <p>所在国家：{this.props.userinfo.address}</p>
                <hr/>
            </div>
        )
    }
}

function mapStateToProps(state) {
    return {
        userinfo: state.userinfo
    }
}

function mapDispatchToProps(dispatch) {
    return {
        userinfoActions: bindActionCreators(userinfoActions, dispatch)
    }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Home)